#ifndef UDP_H
#define UDP_H

#include <QObject>
#include <QUdpSocket>
#include <QHostAddress>
#include <QDebug>

#include "BasePort.h"

class UDP : public BasePort
{
    Q_OBJECT

public:
    Q_INVOKABLE UDP(QObject *parent = 0);
    ~UDP();

    void setPortParam(PortStruct portParam);
    void open();
    void close();
    void write(PortStruct target, QByteArray data);

    void bind(quint16 port);

private:
    QUdpSocket *udp;


private slots:
    void readyReadSlot();
};

#endif // UDP_H
